package learn.opencv.chapter02;

import com.googlecode.javacv.cpp.opencv_core;

import static com.googlecode.javacv.cpp.opencv_highgui.*;
import static com.googlecode.javacv.cpp.opencv_core.*;

/**
 * Created with IntelliJ IDEA.
 * User: joey
 * Date: 23/3/14
 * Time: 下午8:27
 * To change this template use File | Settings | File Templates.
 */
public class Ex2 {

    public static void main(String[] args) {
        cvNamedWindow("Example2", CV_WINDOW_AUTOSIZE);
        CvCapture capture = cvCreateFileCapture("/Users/joey/java-workspaces/opencv-test/data/test.flv");
        IplImage frame = null;
        while(true) {
            frame = cvQueryFrame(capture);
            if (frame == null) {
                break;
            }
            cvShowImage("Example2", frame);
            int c = cvWaitKey(33);
            if (c == 27) {
                break;
            }
        }
        cvReleaseCapture(capture);
        cvDestroyWindow("Example2");

    }


}
